/*
* 1videoConference -- An open source video conferencing platform.
*
* Copyright (C) 2007 - 2008, Adiance Technologies Pvt. Ltd.
*
* Hardik Sanghvi <hardik.sanghvi @adiance.com>
*
* See http://www.1videoconference.org for more information about
* the 1videoConference project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, forums and mailing lists
* for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.IO;
using System.Windows.Controls;
using System.Collections;

using _videoConference.DAL;

namespace _videoConference.BAL
{
    public  class IAddPage
    {
        Database db = new Database();
        DataSet ds = new DataSet();

        public DataSet layoutid()
        {
            try
            {
                ds = db.Layoutid();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet fetchguestname(string mid, string email)
        {
            try
            {
                ds = db.FetchGuestName(mid, email);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public void dbpage(string PName,string PTitle,string PDesc,string Menu)
        {
            try
            {
                db.AddPage(PName, PTitle, PDesc, Menu);
            }
            catch (Exception exp)
            {
            }
        }

        public void dbmodule(string DName,string CName,string MName, string MDesc, string MVersion,string DllId)
        {
            try
            {
                db.AddModule(DName, CName, MName, MDesc, MVersion,DllId);
            }
            catch (Exception exp)
            {
            }
        }

        public bool adddllname(string DName,string ModID)
        {
            try
            {
                bool flag = db.UdtDllTable(DName,ModID);
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public bool addnamespace(string DName,string NName, string NVersion)
        {
            try
            {
                bool flag = db.UdtNamespaceTable(DName, NName, NVersion);
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public string addzipinfo(string fname, string mname, string location)
        {
            try
            {
               return (db.AddZipInfo(mname, fname, location));
                
            }catch(Exception exp)
            {
                return "-1";
            }
        }

        public bool addclass(string NName,string CName)
        {
            try
            {
                bool flag = db.UdtClassTable(NName, CName);
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet getmenuname()
        {
            try
            {
                ds = db.GetMenuName();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getmodulename()
        {
            try
            {
                ds = db.GetModuleName();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getpagename()
        {
            try
            {
                ds = db.GetPageName();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool UdtMenuTable(string MName,string MIName)
        {
            try
            {
                bool flag = db.MenuTable(MName, MIName);
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet getmenu()
        {
            try
            {
                ds = db.GetMenuOrder();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getorder()
        {
            try
            {
                ds = db.GetOrder();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getmaxid()
        {
            try
            {
                ds = db.GetMaxId();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet savemenuitem(int i,int j,byte[] b,string s,string pn)
        {
            try
            {
                ds = db.SaveMenuItem(i, j, b, s, pn);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }

        }

        public DataSet getchildren(int i)
        {
            try
            {
                ds = db.GetChildren(i);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getnonparent()
        {
            try
            {
                ds = db.GetNonParent();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool deletemenu()
        {
            try
            {
                bool flag = db.DeleteMenu();
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public bool updtmenutable(int i, string str)
        {
            try
            {
                bool flag = db.UptMenuTable(i, str);
                return flag;
            }
            catch(Exception exp)
            {
                return false;
            }
        }

        public DataSet selectlayout()
        {
            try
            {
                ds = db.SelectLayout();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool insertlayout(string layout)
        {
            try
            {
                return (db.InsertLayout(layout));
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public bool insertpod(string titlename, string controlname, double height, double width, double left, double top, string layoutname,string modid)
        {
            try
            {
                return (db.InsertPod(titlename, controlname, height, width, left, top, layoutname,modid));
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet setlayout(string layoutname)
        {
            try
            {
                ds = db.SetLayout(layoutname);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet setpod(int i)
        {
            try
            {
                ds = db.SetPod(i);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool deletepod(string layoutname)
        {
            try
            {
                return (db.DeletePod(layoutname));
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet getcontrolname(string layoutname)
        {
            try
            {
                ds = db.GetControlName(layoutname);
                return ds;
            }
            catch(Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getcountry()
        {
            try
            {
                ds = db.GetCountry();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getstate(string s)
        {
            try
            {
                ds = db.GetState(s);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getconfig()
        {
            try
            {
                ds = db.GetConfig();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet userregsel(string name,string pass)
        {
            try
            {
                ds = db.UserRegSel(name,pass);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet guestinfosel(string name)
        {
            try
            {
                ds = db.GuestInfoSel(name);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool setconfig(string smtpserver, string smtpport, string name, string pass, string asteriskserver, string ssl)
        {
            try
            {
                bool flag = db.SetConfig(smtpserver, smtpport, name, pass, asteriskserver, ssl);
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public int guestmeetinginfo(string email,string meetingid)
        {
            try
            {
                int i = db.GuestMeetingInfo(email,meetingid);
                return i;
            }
            catch (Exception exp)
            {
                return 0;
            }

        }

        public int meetinginfo(string name, string pass,string parmid)
        {
            try
            {
                int i = db.MeetingInfo(name, pass, parmid);
                return i;
            }
            catch (Exception exp)
            {
                return 0;
            }
        }

        public bool updlicense(string parmid)
        {
            try
            {
                bool flag = db.UpdLicense(int.Parse(parmid));
                return flag;
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public int datecompare(string date, string time)
        {
            try
            {
                int i = db.DateCompare(date, time);
                return i;
            }
            catch (Exception exp)
            {
                return 0;
            }
        }

        public DataSet accid(string email)
        {
            try
            {
                return db.GetAccId(email);
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet insmeetinginfo(string parUserName, string parPass, string parfname, string parlname, string parcity, string parpincode, string parphone, string parfax, string parMeetingname, string parMeetingDate, string parMeetingStartTime, string parMeetingEndTime, string parcountryid, string parstateid, string parguest1, string parguest1Name, string parguest2, string parguest2Name, string parguest3, string parguest3Name, string parguest4, string parguest4Name, string parguest5, string parguest5Name, string parguest6, string parguest6Name, string paraccId)
        {
            try
            {
                ds = db.InsMeetingInfo(parUserName, parPass, parfname, parlname, parcity, parpincode, parphone, parfax, parMeetingname, parMeetingDate, parMeetingStartTime, parMeetingEndTime, parcountryid, parstateid, parguest1, parguest1Name, parguest2, parguest2Name, parguest3, parguest3Name, parguest4, parguest4Name, parguest5, parguest5Name, parguest6, parguest6Name, paraccId);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
           
        }

        public DataSet meetingsel(string id)
        {
            try
            {
                ds = db.Meetingsel(id);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool deletemeetinginfo(string date, string stime, string etime)
        {
            try
            {
                return db.DeleteMeetingInfo(date, stime, etime);
            }
            catch(Exception exp)
            {
                return false;
            }
        }

        public bool delmeeting(int i)
        {
            try
            {
                return db.DelMeeting(i);
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public bool delzipinfo(string id)
        {
            try
            {
                return db.DelZipInfo(id);
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet getmeetinginfo()
        {
            try
            {
                ds = db.GetMeetingInfo();
                return ds;
            }
            catch(Exception exp)
            {
                return new DataSet();
            }

        }

        public DataSet getzipinfo()
        {
            try
            {
                ds = db.GetZipInfo();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getuserinfo(string id)
        {
            try
            {
                ds = db.GetUserInfo(id);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet fetchguestemailname(string id)
        {
            try
            {
                ds = db.FetchGuestEmailName(id);
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet userreg(string id)
        {
            try
            {
                ds = db.UserReg(id);
                return ds;
            }
            catch(Exception exp)
            {
                return new DataSet();
            }
        }

        public DataSet getallpod()
        {
            try
            {
                ds = db.GetAllPod();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool delpodid(string PodID)
        {
            try
            {
                return(db.DelPodID(PodID));
            }
            catch
            {
                return false;
            }

        }

        public DataSet getzipmodule(string id)
        {
            try
            {
                return (db.GetZipModule(id));
            }
            catch
            {
                return new DataSet();
            }
            
        }

        public DataSet getdllinfo()
        {
            try
            {
                return (db.GetDllInfo());
            }
            catch
            {
                return new DataSet();
            }

        }

        public DataSet getclassdll(string id)
        {
            try
            {
                return (db.GetClassDll(id));
            }
            catch
            {
                return new DataSet();
            }
        }

        public int uservalidation(string email, string password)
        {
            try
            {
                return (db.UserValidation(email, password));
            }
            catch
            {
                return 0;
            }
        }

        public int checkmodule(string modulename)
        {
            try
            {
                return (db.CheckModule(modulename));
            }
            catch
            {
                return 0;
            }
        }

        public DataSet getmoduleinfo()
        {
            try
            {
                ds = db.GetModuleInfo();
                return ds;
            }
            catch (Exception exp)
            {
                return new DataSet();
            }
        }

        public bool delmoduleinfo(string id)
        {
            try
            {
                return db.DelModuleInfo(id);
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet editmodule(string modulename)
        {
            try
            {
                return (db.EditModule(modulename));
            }
            catch
            {
                return new DataSet();
            }
        }

        public bool updmodule(string id,string mname,string desc,string ver)
        {
            try
            {
                return db.UpdModule(id,mname,desc,ver);
            }
            catch (Exception exp)
            {
                return false;
            }
        }

        public DataSet getmodid(string controlname)
        {
            try
            {
                return (db.GetModId(controlname));
            }
            catch
            {
                return new DataSet();
            }
        }
    }
}
